package crivia.ecp.ebp;

import java.io.PrintWriter;
import java.net.URLEncoder;
import java.util.Enumeration;

import javax.servlet.ServletContext;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import crivia.ecp.common.ECR;
import crivia.mvc.i.Executer;

import weaver.general.BaseBean;
import weaver.general.Util;
import weaver.hrm.User;
import weaver.systeminfo.SystemEnv;

public class E7BP_title {

	@SuppressWarnings({ "unused", "deprecation" })
	public static void tt(String titlename, String imageFileName,
			String needHelp, User user, HttpServletRequest request,
			HttpServletResponse response, ServletContext application,
			Class<? extends Executer> ecpClass) throws Exception {

		javax.servlet.http.HttpSession session = request.getSession(true);
		PrintWriter out = response.getWriter();
		response.setContentType("text/html");

		out.write(_jsp_string0, 0, _jsp_string0.length);
		weaver.conn.RecordSet RecordSetFavourite;
		RecordSetFavourite = (weaver.conn.RecordSet) application
				.getAttribute("RecordSetFavourite");
		if (RecordSetFavourite == null) {
			RecordSetFavourite = new weaver.conn.RecordSet();
			application.setAttribute("RecordSetFavourite", RecordSetFavourite);
		}
		out.write(_jsp_string1, 0, _jsp_string1.length);

		int isIncludeToptitle = 1;
		String gopage = "";
		String hostname = request.getServerName();
		String uri = request.getRequestURI();
		String querystring = "";
		titlename = ECR.ns(titlename);
		String ajaxs = "";
		for (Enumeration<?> En = request.getParameterNames(); En
				.hasMoreElements();) {
			String tmpname = (String) En.nextElement();

			if (tmpname.equals("ajax")) {
				ajaxs = tmpname;
				continue;
			}
			String tmpvalue = Util.toScreen(request.getParameter(tmpname),
					user.getLanguage(), "0");
			querystring += "^" + tmpname + "=" + tmpvalue;
		}
		if (!querystring.equals(""))
			querystring = querystring.substring(1);

		String pagename = titlename;

		session.setAttribute("fav_pagename", pagename);
		session.setAttribute("fav_uri", uri);
		session.setAttribute("fav_querystring", querystring);
		int addFavSuccess = Util.getIntValue(session
				.getAttribute("fav_addfavsuccess") + "");
		session.setAttribute("fav_addfavsuccess", "");
		pagename = URLEncoder.encode(pagename);

		// is workflow page
		boolean isWfFomPage = false;
		String strUrl = request.getRequestURL().toString();

		if (strUrl.indexOf("AddRequest.jsp") != -1
				|| strUrl.indexOf("ManageRequestNoForm.jsp") != -1
				|| strUrl.indexOf("ManageRequestNoFormMode.jsp") != -1
				|| strUrl.indexOf("ManageRequestNoFormBill.jsp") != -1
				|| strUrl.indexOf("ViewRequest.jsp") != -1) {
			isWfFomPage = true;
		}

		out.write(_jsp_string2, 0, _jsp_string2.length);
		out.print((isWfFomPage ? "4px" : "10px"));
		out.write(_jsp_string3, 0, _jsp_string3.length);
		if (imageFileName != null && !imageFileName.equals("")) {
			out.write(_jsp_string4, 0, _jsp_string4.length);
			out.print((imageFileName));
			out.write(_jsp_string5, 0, _jsp_string5.length);
		}
		out.write(_jsp_string6, 0, _jsp_string6.length);
		out.print((titlename));
		out.write(_jsp_string7, 0, _jsp_string7.length);
		out.print((SystemEnv.getHtmlLabelName(257, user.getLanguage())));
		out.write(_jsp_string8, 0, _jsp_string8.length);

		if (!needHelp.equals("")) {

			out.write(_jsp_string9, 0, _jsp_string9.length);

		}

		out.write(_jsp_string10, 0, _jsp_string10.length);
		out.print((SystemEnv.getHtmlLabelName(15408, user.getLanguage())));
		out.write(_jsp_string11, 0, _jsp_string11.length);

		if (!ajaxs.equals("ajax")) {

			out.write(_jsp_string12, 0, _jsp_string12.length);
			out.print((SystemEnv.getHtmlLabelName(18753, user.getLanguage())));
			out.write(_jsp_string13, 0, _jsp_string13.length);
		}
		out.write(_jsp_string14, 0, _jsp_string14.length);
		out.print((SystemEnv.getHtmlLabelName(275, user.getLanguage())));
		out.write(_jsp_string15, 0, _jsp_string15.length);
		out.print((isWfFomPage ? "0px" : "10px"));
		out.write(_jsp_string16, 0, _jsp_string16.length);

		BaseBean baseBean_TopTitle = new BaseBean();
		int userightmenu_TopTitle = 1;
		try {
			userightmenu_TopTitle = Util.getIntValue(baseBean_TopTitle
					.getPropValue("systemmenu", "userightmenu"), 1);
		} catch (Exception e) {
		}
		if (userightmenu_TopTitle == 0) {

			out.write(_jsp_string17, 0, _jsp_string17.length);
		}
		out.write(_jsp_string18, 0, _jsp_string18.length);

		if (userightmenu_TopTitle == 0) {

			out.write(_jsp_string19, 0, _jsp_string19.length);

		}

		out.write(_jsp_string20, 0, _jsp_string20.length);
		out.print((gopage));
		out.write(_jsp_string21, 0, _jsp_string21.length);
		out.print((titlename));
		out.write(_jsp_string22, 0, _jsp_string22.length);
		out.print((SystemEnv.getHtmlLabelName(18754, user.getLanguage())));
		out.write(_jsp_string23, 0, _jsp_string23.length);
		if (addFavSuccess == 1) {
			out.write(_jsp_string24, 0, _jsp_string24.length);
		}
		out.write(_jsp_string25, 0, _jsp_string25.length);
		out.print((URLEncoder.encode(uri)));
		out.write(_jsp_string26, 0, _jsp_string26.length);
		out.print((URLEncoder.encode(querystring)));
		out.write(_jsp_string27, 0, _jsp_string27.length);
	}

	private final static char[] _jsp_string15;
	private final static char[] _jsp_string3;
	private final static char[] _jsp_string7;
	private final static char[] _jsp_string5;
	private final static char[] _jsp_string14;
	private final static char[] _jsp_string19;
	private final static char[] _jsp_string8;
	private final static char[] _jsp_string27;
	private final static char[] _jsp_string9;
	private final static char[] _jsp_string24;
	private final static char[] _jsp_string18;
	private final static char[] _jsp_string25;
	private final static char[] _jsp_string2;
	private final static char[] _jsp_string4;
	private final static char[] _jsp_string1;
	private final static char[] _jsp_string6;
	private final static char[] _jsp_string17;
	private final static char[] _jsp_string23;
	private final static char[] _jsp_string11;
	private final static char[] _jsp_string26;
	private final static char[] _jsp_string20;
	private final static char[] _jsp_string12;
	private final static char[] _jsp_string16;
	private final static char[] _jsp_string13;
	private final static char[] _jsp_string10;
	private final static char[] _jsp_string22;
	private final static char[] _jsp_string21;
	private final static char[] _jsp_string0;
	static {
		_jsp_string15 = "\" onclick=\"showHelp();\" ></BUTTON> \r\n				</td>\r\n			     <td width=\"10\">&nbsp;</td >\r\n			  </TR>\r\n			  </TBODY>\r\n			</TABLE>\r\n		</td>\r\n		<td width=\""
				.toCharArray();
		_jsp_string3 = "\">&nbsp;</td>\r\n		<td  width=\"*\">\r\n			<TABLE cellSpacing=0 cellPadding=0 width=\"100%\" border=0  class=TopTitle>\r\n			  <TBODY>\r\n			  <TR>\r\n			  "
				.toCharArray();
		_jsp_string7 = "</SPAN></TD>\r\n			    <TD align=right>&nbsp;</TD>\r\n			    <TD width=5></TD>    \r\n			    <TD align=middle width=24><!-- <BUTTON style=\"display:none\" class=btnLittlePrint id=onPrint title=\""
				.toCharArray();
		_jsp_string5 = "\" height=\"18px\"></TD>\r\n			   ".toCharArray();
		_jsp_string14 = "&nbsp;\r\n				 <BUTTON class=btnHelp id=btnHelp\r\n			    title=\""
				.toCharArray();
		_jsp_string19 = "	\r\ndoSetTopMenu();\r\nfunction doSetTopMenu(){\r\n	var needShow = null;\r\n	try{\r\n		var obj = document.getElementById(\"needShow\");\r\n		needShow = obj.value;\r\n	}catch(e){}\r\n	if(needShow!=null && needShow==\"1\"){\r\n		try{\r\n			var objRightMenuDiv = document.getElementById(\"rightMenu\");\r\n			var rightMenuIframe = document.getElementById(\"rightMenuIframe\");\r\n			var objMenuDiv = document.getElementById(\"divTopMenu\");\r\n			if(objRightMenuDiv!=null && window.frames[\"rightMenuIframe\"].document.getElementById(\"menuTable\").innerHTML!=\"\"){\r\n				if(rightMenuIframe!=null){\r\n					objMenuDiv.appendChild(rightMenuIframe);\r\n				}\r\n				objRightMenuDiv.outerHTML = \"\";\r\n				objRightMenuDiv.style.height = \"0px\";\r\n				window.document.body.style.marginTop = \"0px\";\r\n				objRightMenuDiv.style.border = \"0px\";\r\n				objRightMenuDiv.style.position = \"relative\";\r\n				objRightMenuDiv.style.display = \"none\";\r\n			}\r\n		}catch(e){}\r\n	}else{\r\n		try{\r\n			document.getElementById(\"divTopMenu\").style.border = \"0px\";\r\n		}catch(e){}\r\n	}\r\n}\r\n"
				.toCharArray();
		_jsp_string8 = "\" onclick=\"javascript:window.print();\" style=\"display:none\"></BUTTON> -->\r\n				</TD>\r\n			    "
				.toCharArray();
		_jsp_string27 = "');\r\n}\r\n</script>\r\n\r\n\r\n".toCharArray();
		_jsp_string9 = "\r\n			    <TD align=middle width=24><!--<BUTTON style=\"display:none\" class=btnHelp ></BUTTON> --></TD>\r\n			    "
				.toCharArray();
		_jsp_string24 = "\r\n    showAddFavMsg();\r\n".toCharArray();
		_jsp_string18 = "\r\n\r\n<script language=javascript>\r\n"
				.toCharArray();
		_jsp_string25 = "\r\nfunction showHelp(){\r\n    var pathKey = this.location.pathname;\r\n    //alert(pathKey);\r\n    if(pathKey!=\"\"){\r\n        pathKey = pathKey.substr(1);\r\n    }\r\n    var operationPage = \"http://help.e-cology.com.cn/help/RemoteHelp.jsp\";\r\n    //var operationPage = \"http://localhost/help/RemoteHelp.jsp\";\r\n    var screenWidth = window.screen.width*1;\r\n    var screenHeight = window.screen.height*1;\r\n\r\n    window.open(operationPage+\"?pathKey=\"+pathKey,\"_blank\",\"top=0,left=\"+(screenWidth-800)/2+\",height=\"+(screenHeight-90)+\",width=800,status=no,scrollbars=yes,toolbar=yes,menubar=no,location=no\");\r\n\r\n\r\n\r\n}\r\nfunction openFavouriteBrowser()\r\n{  \r\n	\r\n	var BacoTitle = jQuery(\"#BacoTitle\");\r\n	var pagename = \"\";\r\n\r\n	if(BacoTitle)\r\n	{\r\n		pagename = BacoTitle.text();\r\n	}\r\n	window.showModalDialog('/favourite/FavouriteBrowser.jsp?fav_pagename='+pagename+'&fav_uri="
				.toCharArray();
		_jsp_string2 = "\r\n<DIV id=\"divTopTitle\">	\r\n	<TABLE cellSpacing=0 cellPadding=0 width=\"100%\" border=0>\r\n		<tr>\r\n		<td width=\""
				.toCharArray();
		_jsp_string4 = "\r\n			    <TD align=left width=45><IMG src=\""
				.toCharArray();
		_jsp_string1 = "\r\n\r\n\r\n".toCharArray();
		_jsp_string6 = "\r\n			    <TD align=left style=\"padding-top:3px\"><SPAN id='BacoTitle' >"
				.toCharArray();
		_jsp_string17 = "\r\n<div id=\"divTopMenuSpace\" name=\"divTopMenuSpace\" height=\"1\" style=\"BACKGROUND-COLOR:#FFFFFF;border:1px solid #FFFFFF\"></div>\r\n<div id=\"divTopMenu\" name=\"divTopMenu\" class=\"topmenuTable\" style=\"margin:0 3px 0 3px;BACKGROUND-COLOR:#ECECEC;border:1px solid #979797\">\r\n</div>\r\n"
				.toCharArray();
		_jsp_string23 = "\");\r\n}\r\n\r\n".toCharArray();
		_jsp_string11 = "\" onclick=\"javascript:history.back();\" style=\"display:none\"></BUTTON> -->\r\n				 </TD>\r\n			     <td align=\"right\">\r\n				 "
				.toCharArray();
		_jsp_string26 = "&fav_querystring=".toCharArray();
		_jsp_string20 = "\r\n/*\r\nfunction addtofavorites(){\r\n	window.external.AddFavorite('"
				.toCharArray();
		_jsp_string12 = " <BUTTON class=btnFavorite id=BacoAddFavorite\r\n			    title=\""
				.toCharArray();
		_jsp_string16 = "\"></td>\r\n		</tr>\r\n		</TABLE>\r\n</DIV>\r\n"
				.toCharArray();
		_jsp_string13 = "\" onclick=\"openFavouriteBrowser();\" ></BUTTON>"
				.toCharArray();
		_jsp_string10 = "\r\n				 <TD align=middle width=24><!--<BUTTON class=btnBack id=onBack title=\""
				.toCharArray();
		_jsp_string22 = "');\r\n}\r\n*/\r\n\r\nfunction showAddFavMsg(){\r\n    alert(\""
				.toCharArray();
		_jsp_string21 = "', '".toCharArray();
		_jsp_string0 = "\r\n\r\n".toCharArray();
	}

}
